<template>
  <div class="box">
   <template v-for="item in records">
    <component class="m_t_20" :is="FormComponents[item.tag]" :code="item.code" :isEnabled="item.isEnabled" :type="type" :unitId="unitId" :isAudit="true"/>
</template>
  </div>
</template>

<script lang='ts'>
import {defineComponent, reactive, toRefs,onBeforeMount} from 'vue'
import {useRoute} from 'vue-router'
import {FormComponents} from '../../../../components/formChildren/myComponents'
import {unitFormGet} from '../../../../api/system/flowPath'
import {flowPathChildFormDetailType} from '../../../../type/system'
export default defineComponent({
name:'',
components:{
},
setup(){
const data:flowPathChildFormDetailType = reactive({
  type:'smallForm',//默认为小表单(smallForm), 大表单(bigForm)，使用表单(useForm)
  records:[],
  unitId:'',
})
const route=useRoute()
onBeforeMount(()=>{
  data.type=route.query.type as string
   if(route.query.id){
    unitFormGet({id:route.query.id as string}).then((res:any)=>{
      res.forms.map(item=>{
        if(item.category==1){
          item.code=item.tag
          item.tag='customize'
        }
       
      })
    data.records=res.forms
    data.unitId=res.id
    })
   }else{
     data.records=[{tag:route.query.code as string,isEnabled:1}]
   }
})


return {
...toRefs(data),
FormComponents,
route
}
}
})
</script>
<style scoped lang='scss'>
.box{
    width: calc(100% - 64px);
    height: calc(100% - 25px);
    background: #fff;
    box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding:1px 32px 24px 32px ;
    overflow-y: auto;
}
</style>